package com.saturn.config.server.base.enums;

import cn.hutool.core.util.StrUtil;

/**
 * 
 * <dl>
 *    <dt><b>Title:</b></dt>
 *    <dd>
 *    	none
 *    </dd>
 *    <dt><b>Description:</b></dt>
 *    <dd>
 *    	<p>流程状态
 *    </dd>
 * </dl>
 *
 * @author tanks
 * @version 1.0, 2019年6月11日
 * @since saturn-common
 *
 */
public enum EnvTypeEnum {
	
	DEV("dev","开发环境"),
	TEST("test","测试环境"),
	STAT("stat","预发布环境"),
	PROD("prod","生产环境"),;
	
	private String code;
	private String desc;

	private EnvTypeEnum(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
	
	public static EnvTypeEnum transfer(String code) {
		if (StrUtil.isNotBlank(code)) {
			for (EnvTypeEnum entity : values()) {
				if( entity.getCode().equals(code) ) {
					return entity;
				}
			}
		}
		return null;
	}
}
